#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n,m,p,q;
    cin>>n>>m>>p>>q;
    if(n%p!=0)cout<<"YES"<<endl;
    else
    {
        if(n/p*q==m)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}